import {Injectable} from '@angular/core';
import {HttpService} from '@kylin/http';
import {
    FormBase,
    FormCascader,
    FormDate,
    FormInput,
    FormLocation,
    FormSelect,
    FormText,
    FormTitle,
    FormUpload,
    FormDateRange
} from '@kylin/shared';

const options = [
    {
        value: 'zhejiang',
        label: 'Zhejiang',
        children: [{
            value: 'hangzhou',
            label: 'Hangzhou',
            children: [{
                value: 'xihu',
                label: 'West Lake',
                isLeaf: true
            }]
        }, {
            value: 'ningbo',
            label: 'Ningbo',
            isLeaf: true
        }]
    }, {
        value: 'jiangsu',
        label: 'Jiangsu',
        children: [{
            value: 'nanjing',
            label: 'Nanjing',
            children: [{
                value: 'zhonghuamen',
                label: 'Zhong Hua Men',
                isLeaf: true
            }]
        }]
    }];

@Injectable({
    providedIn: 'root'
})
export class DevelopmentMaService {

    constructor(private http: HttpService) {
    }

    getForms() {
        return [
            new FormInput({
                    key: 'equal',
                    label: 'equal',
                    required: true,
                    value: '',
                    length: 12,
                    disabled: false,
                    validators: {decimalPlaces: [6], checkTypes: ['number']}
                }
            ),
            new FormInput({
                    key: 'input',
                    label: 'input',
                    required: true,
                    value: '',
                    length: 12,
                    disabled: false,
                    validators: {decimalPlaces: [6], checkTypes: ['number'], equalToValidator: ['equal']}
                }
            ),
            new FormCascader(
                {
                    key: 'cascader',
                    label: 'cascader',
                    value: '',
                    options: options
                }
            ),
            new FormDate({
                key: 'date',
                label: 'date',
                value: ''
            }),
            new FormTitle(
                {
                    key: 'title',
                    label: '地块定位'
                }
            ),
            new FormLocation(
                {
                    key: 'location',
                    label: 'location',
                    value: [{num: 0, eastLongitude: '', northLatitude: '', altitude: ''}],
                    required: true
                }
            ),
            new FormText({
                key: 'text',
                label: 'text',
                value: ''
            }),
            new FormSelect(
                {
                    key: 'select',
                    label: 'select',
                    value: '',
                    options: [{label: 'jack', value: 'jack'}, {label: 'lucy', value: 'lucy'}]
                }
            ),
            new FormUpload({
                key: 'upload',
                label: 'upload',
                type: 'upload'
            }),
            new FormDateRange({
                key: 'dateRange',
                label: 'dateRange',
            })


        ];
    }
}
